class_name AchievementSystem
extends BaseSystem

#region 属性
@export var achievements:Array[Achievement]
var achievement_dict:Dictionary = {}
#endregion
#region 字段
#endregion
#region 信号
#endregion

#region 基类方法
func init_system():
	super.init_system()
	achievement_dict.clear()
	# TODO 从StorageSystem中读取Achievement，如果没有就初始化一下
	for achievement in achievements:
		if not achievement_dict.has(achievement.id):
			achievement_dict[achievement.id] == achievement.duplicate(true)
#endregion
#region 公共方法
func unlock_achievement_by_id(achievement_id:String):
	if achievement_dict.has(achievement_id) and not achievement_dict[achievement_id].unlocked:
		achievement_dict[achievement_id].unlocked = true
#endregion
#region 私有方法
#endregion
#region 生命周期函数
#endregion
